<html>
<head><meta charset="utf-8"><title>Suggestion for removing trait bounds in impl types · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Suggestion.20for.20removing.20trait.20bounds.20in.20impl.20types.html">Suggestion for removing trait bounds in impl types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214616335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Suggestion%20for%20removing%20trait%20bounds%20in%20impl%20types/near/214616335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Suggestion.20for.20removing.20trait.20bounds.20in.20impl.20types.html#214616335">(Oct 26 2020 at 18:41)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Struct</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">);</span><span class="w"></span>
<span class="k">trait</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Trait</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Struct</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nc">Trait</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>

<p>Errors because of the trait bound in <code>for Struct&lt;T: Trait&gt;</code>, but none of the errors suggest that:</p>
<div class="codehilite"><pre><span></span><code>error[E0658]: associated type bounds are unstable
 --&gt; src/lib.rs:4:33
  |
4 | impl&lt;T: Trait&gt; Trait for Struct&lt;T: Trait&gt; {}
  |                                 ^^^^^^^^
  |
  = note: see issue #52662 &lt;https://github.com/rust-lang/rust/issues/52662&gt; for more information

error[E0107]: wrong number of type arguments: expected 1, found 0
 --&gt; src/lib.rs:4:26
  |
4 | impl&lt;T: Trait&gt; Trait for Struct&lt;T: Trait&gt; {}
  |                          ^^^^^^^^^^^^^^^^ expected 1 type argument

error[E0229]: associated type bindings are not allowed here
 --&gt; src/lib.rs:4:33
  |
4 | impl&lt;T: Trait&gt; Trait for Struct&lt;T: Trait&gt; {}
  |                                 ^^^^^^^^ associated type not allowed here
</code></pre></div>



<a name="214616413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Suggestion%20for%20removing%20trait%20bounds%20in%20impl%20types/near/214616413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Suggestion.20for.20removing.20trait.20bounds.20in.20impl.20types.html#214616413">(Oct 26 2020 at 18:42)</a>:</h4>
<p>Is this a thing we should recommend?</p>
<p>/cc <span class="user-mention" data-user-id="119031">@Esteban Küber</span></p>



<a name="214616774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Suggestion%20for%20removing%20trait%20bounds%20in%20impl%20types/near/214616774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Suggestion.20for.20removing.20trait.20bounds.20in.20impl.20types.html#214616774">(Oct 26 2020 at 18:45)</a>:</h4>
<p>Yes. Particularly for the first and last, we should suggest where the bound should go.</p>



<a name="214625946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Suggestion%20for%20removing%20trait%20bounds%20in%20impl%20types/near/214625946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Suggestion.20for.20removing.20trait.20bounds.20in.20impl.20types.html#214625946">(Oct 26 2020 at 20:04)</a>:</h4>
<p>Shall I file an issue, or do you think we have one?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>